import Vue from 'vue';

const component2 = {

    model: {
        props: 'value1',
        event: 'input1'

    },
    props: {
        value: String
    },
    template: `
        <div>
            <input type='text' :value="value" @input='handleChange'>
        </div>
    `,

    methods: {

        handleChange() {
            console.log('handleChange')
            this.$emit('input1', event.target.value)
        }
    }
}

new Vue({
    el: '#app',

    data() {
        return {
            value1: '123'
        }
    },
    watch: {
        value1() {
            console.log(this.value1)
        }
    },
    components: {
        component2,
    },
    // template: `<div><component2 :value="value" @input1='value = arguments[0]'></component2></div>`
    template: `<div><component2 v-model='value1'></component2></div>`
})
